package com.leyou.itme.client;

import com.leyou.common.page.pageResult;
import com.leyou.item.dto.*;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient("item-service")
public interface ItemClient {

    /*根据分类ids查询分类集合*/
    @GetMapping("/category/list")
    List<CategoryDTO> findCategoryByIds(@RequestParam("ids") List<Long> ids);

    /*根据品牌id查询品牌数据*/
    @GetMapping("/brand/{id}")
    BrandDTO findBrandById(@PathVariable("id")Long id);

    /*根据spu_id查询所有sku数据*/
    @GetMapping("/sku/of/spu")
    List<SkuDTO> findSkuBySpuId(@RequestParam("id")Long spuId);

    /*根据sup_id查询supDetail*/
    @GetMapping("/spu/detail")
    SpuDetailDTO findSpuDetailBySupId(@RequestParam("id")Long supId);

    /*根据分类id查询规格参数集合*/
    @GetMapping("/spec/params")
    List<SpecParamDTO> findSpecParam(@RequestParam(value = "gid",required =false) Long gid,
                                      @RequestParam(value = "cid",required = false)Long cid,
                                      @RequestParam(value = "searching" ,required = false)Boolean searching);


    /*分页查询spuDTO数据*/
      @GetMapping("/spu/page")
      pageResult<SpuDTO> findSpuByPage(@RequestParam(value = "page",required = false,defaultValue = "1")Integer page,
                                                            @RequestParam(value = "rows",required = false,defaultValue = "5")Integer rows,
                                                            @RequestParam(value = "key",required = false)String key,
                                                            @RequestParam(value = "saleable",required = false)Boolean saleable);


      //根据品牌id批量查询品牌
    @GetMapping("/brand/list")
    List<BrandDTO> findBrandByIds(@RequestParam("ids")List<Long> ids);

    /*根据id查询spuDto*/

    /*GET /spu/{id}*/
    @GetMapping("/spu/{id}")
    SpuDTO findSpuById(@PathVariable("id") Long spuId);


    /*根据categoryId查询规格参数组和组内参数*/
    @GetMapping("/spec/of/category")
    List<SpecGroupDTO> findSpecGroupDTO(@RequestParam("id") Long cid);
}
